package com.wunong.smart.collection;

import com.wunong.smart.collection.client.service.CollectionOperateService;
import com.wunong.smart.collection.client.service.CollectionReadService;
import com.wunong.smart.collection.domain.service.CollectionDomainService;
import com.wunong.smart.collection.domain.service.impl.CollectionDomainServiceImpl;
import com.wunong.smart.collection.domain.state.CollectionStateFactory;
import com.wunong.smart.collection.domain.state.CollectionStateService;
import com.wunong.smart.collection.domain.state.impl.DefaultCollectionStateFactory;
import com.wunong.smart.collection.domain.state.impl.DefaultCollectionStateService;
import com.wunong.smart.collection.service.CollectionOperateServiceImpl;
import com.wunong.smart.collection.service.CollectionReadServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author created by zealot.zt
 */
@Configuration
public class CollectionDomainConfiguration {

    @ConditionalOnMissingBean(CollectionDomainService.class)
    @Bean
    public CollectionDomainService defaultCollectionDomainService() {
        return new CollectionDomainServiceImpl();
    }

    @Bean
    @ConditionalOnMissingBean(CollectionOperateService.class)
    public CollectionOperateService defaultCollectionOperateService() {
        return new CollectionOperateServiceImpl();
    }

    @Bean
    @ConditionalOnMissingBean(CollectionReadService.class)
    public CollectionReadService defaultCollectionReadService() {
        return new CollectionReadServiceImpl();
    }

    @ConditionalOnMissingBean(CollectionStateFactory.class)
    @Bean
    public CollectionStateFactory defaultCollectionStateFactory() {
        return new DefaultCollectionStateFactory();
    }

    @ConditionalOnMissingBean(CollectionStateService.class)
    @Bean
    public CollectionStateService collectionStateService() {
        return new DefaultCollectionStateService();
    }

}
